Page({
  data:{
    address:{},
    cart:[],
    totalPrice:0,
    totalSelectedGoodsNum:0
  },
  onLoad:function(options) {
  },
  onShow() {
    const address = wx.getStorageSync('address');
    let cart = wx.getStorageSync('cart') || [];
    cart = cart.filter((val, i) => {return val['is_cart_selected'];});
    let totalPrice = 0, totalSelectedGoodsNum = 0;
    cart.forEach((val, i, self) => {
      totalPrice += val['in_cart_number'] * val['goods_price'];
      totalSelectedGoodsNum++;
    });
    this.setData({address, cart, totalPrice, totalSelectedGoodsNum});
  }
});